const keyString = 'soft2Todos'
// 从本地存储中，读取数据
export const readData = () => {
    let data = localStorage.getItem(keyString)
    if (!data) {
        return []
    }
    try {
        return JSON.parse(data) || []
    } catch (error) {
        console.error('解析本地存储数据失败:', error)
        return []
    }
}

// 将数据存放到本地存储中
export const writeData = (data) => {
    localStorage.setItem(keyString, JSON.stringify(data));
}